package com.yznote.cloudesk.user.controller;

import com.yznote.cloudesk.common.Anno.CollectLogs;
import com.yznote.cloudesk.common.constants.ModuleConstant;
import com.yznote.cloudesk.common.pojo.Notice;
import com.yznote.cloudesk.common.pojo.Result;
import com.yznote.cloudesk.user.server.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/notice")
@CollectLogs(moduleName = ModuleConstant.NOTICE_MODULE)
public class NoticeController {
    @Autowired
    NoticeService noticeService;
    @GetMapping("/pullNotice")
    public Result pullNotice(){
        List<Notice> noticeList = noticeService.pullNotice();
        if(noticeList==null) return Result.fail("拉取通知失败");
        return Result.success(noticeList);
    }
}
